package PTA.javaA;

import java.util.Scanner;

public class fn06 {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String choice = sc.next();
            try {
                if (choice.equals("number"))
                    throw new NumberFormatException();
                else if (choice.equals("illegal")) {
                    throw new IllegalArgumentException();
                } else if (choice.equals("except")) {
                    throw new Exception();
                } else {
                    break;
                }
            } catch (Exception e) {
               if(choice.equals("number")){
                   System.out.println("number format exception");
                   System.out.println(e);
               }else if(choice.equals("illegal")){
                   System.out.println("illegal argument exception");
                   System.out.println(e);
               }else if(choice.equals("except")){
                   System.out.println("other exception");
                   System.out.println(e);
               }
            }
            /*这里放置你的答案*/
        }//end while
        sc.close();
    }

}
